﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Sql;
using System.Data;
using DTO;
using System.Data.SqlClient;

namespace DAO
{
   public class XeDAO
    {
        public List<XeDTO> DanhSachXe()
        {
            Data dv = new Data();
            DataTable ds = new DataTable();
            List<XeDTO> lstxe = new List<XeDTO>();
            string procname = "sp_DanhSachXe";
            ds=dv.ExecuteQueryNonParameter(procname);

            for (int i = 0; i < ds.Rows.Count; i++)
            {
                XeDTO xe = new XeDTO();
                xe.MaXe = (int)ds.Rows[i][0];
                xe.Maxestring = ds.Rows[i][0].ToString();
                xe.BienSo = ds.Rows[i][1].ToString();
                xe.TrongTai = float.Parse(ds.Rows[i][2].ToString());
                xe.Isvalible = int.Parse(ds.Rows[i][3].ToString());

                lstxe.Add(xe);

            }

            return lstxe;
        }
    }
}
